package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.DiseaseBean;
import com.project.dao.IDiseaseDao;
import com.project.service.IDiseaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author RJ
 * @date 2022/9/14 16:41
 */
@Service
@Transactional
public class DiseaseServiceImpl extends ServiceImpl<IDiseaseDao, DiseaseBean> implements IDiseaseService {
    @Override
    public void addDisease(DiseaseBean diseaseBean) {
        this.save(diseaseBean);
    }

    @Override
    public DiseaseBean getDiseaseInfo(Integer diseaseId) {
        return this.baseMapper.getDiseaseInfo(diseaseId);
    }

    @Override
    public IPage<DiseaseBean> cutDiseaseByItem(Integer pageNo, Integer pageSize, String diseaseName, String diseaseSymptoms) {
        Page<DiseaseBean> page = new Page<>(pageNo, pageSize);
        IPage<DiseaseBean> iPage = this.baseMapper.cutDiseaseByItem(page, diseaseName, diseaseSymptoms);
        return iPage;
    }
}
